# Author:Li
from django import forms
from apps.operations.models import UserFavorite, CourseComments

# 传统Form校验
# class CommentsForm(forms.Form):
#     course = forms.CharField(required=True, min_length=1)
#     comments = forms.CharField(required=True, max_length=200)
#
#     def clean_course_id(self):
#         course = int(self.data.get("course"))
#         course = CourseComments.objects.get(id=course).id
#         return course


class CommentsForm(forms.ModelForm):

    class Meta:
        model = CourseComments
        fields = ["course", "comments"]


class UserFavForm(forms.ModelForm):

    class Meta:
        model = UserFavorite
        fields = ["fav_id", "fav_type"]
